<template>
  <div>
    <page-bg class="page-bg" title="资料" />
    <n-grid item-responsive>
      <n-gi span="1 800:1 1200:4" />
      <n-gi span="22 800:22 1200:16">
        <div
          class="about-me"
          :class="sideTheme"
          v-for="(item, index) in list"
          :key="'item_' + index"
        >
          <title-card :title="item.name" />
          <n-grid :x-gap="12" item-responsive>
            <n-gi
              span="24 400:12 800:6"
              v-for="(card, index1) in item.list"
              :key="'card_' + index1"
            >
              <n-card hoverable style="margin-top: 20px">
                <a :href="card.a" target="_blank">
                  <div class="card-box">
                    <img :src="card.img" alt="" />
                    <div class="card-right">
                      <span class="name">{{ card.title }}</span>
                      <span>{{ card.description }}</span>
                    </div>
                  </div>
                </a>
              </n-card>
            </n-gi>
          </n-grid>
        </div>
      </n-gi>
      <n-gi span="1 800:0" />
    </n-grid>
  </div>
</template>

<script setup name="AboutMe">
import PageBg from '@/components/PageBg/index.vue';
import TitleCard from '@/components/TitleCard/index.vue';
import { ref, onMounted } from 'vue';
import { getInformation } from '@/api/article.js';
import { useSettingsStore } from '@/store';

const settingsStore = useSettingsStore();
const sideTheme = computed(() => settingsStore.sideTheme);
const list = ref([]);
onMounted(() => {
  getInformation().then((res) => {
    list.value = res.data;
  });
});
</script>

<style lang="scss" scoped>
* {
  padding: 0;
  margin: 0;
}

.page-bg {
  width: 100%;
  height: 400px;
}
.about-me {
  box-sizing: border-box;
  margin-top: 20px;
  padding: 40px 35px;
  background: rgba(255, 255, 255, 0.9);
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 3px 8px 6px rgba(7, 17, 27, 0.05);
}
.card-box {
  display: flex;
  align-items: center;
  img {
    width: 30px;
    height: 30px;
  }
  .card-right {
    display: inline-flex;
    flex-wrap: wrap;
    margin-left: 10px;
    .name {
      font-size: 15px;
      font-weight: 700;
    }
    .name:hover {
      color: #80c8f8;
    }
    span {
      width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 1;
      -webkit-box-orient: vertical;
    }
  }
}
.theme-dark {
  background: rgba(0, 0, 0, 0.5);
  color: #ffffffb3;
}
:deep(a) {
  color: #000 !important;
}
</style>
